import time

def metric(fn):
    start_time = time.time()
    #循环执行
    fn()
    end_time = time.time()
    print('耗时：{:.4f}s'.format(end_time - start_time))
    return fn

#装饰器
@metric
def run():
    i = 1
    for i in range(999999):
        i += 1
    print (i)

run()